<?php
// +----------------------------------------------------------------------
// | 功能说明"
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2030 http://www.jmzh1688.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: lxl
// +----------------------------------------------------------------------
namespace app\admin\model;

use think\Model;

class LogActionModel extends Model
{
    
    protected $name = 'log_action';
    protected $autoWriteTimestamp = true;//时间自动更新 create_time ,update_time


    public $title = '名称';

    /**
     * 添加一条数据，并检验
     */
    public function insert($param)
    {
       
        try{
            $result =  $this->save($param);
            if(false === $result){
                return msg(-1, '', $this->getError());
            }else{

                return msg(1, '', '');
            }
        }catch(PDOException $e){

            return msg(-2, '', $e->getMessage());
        }
    }



    public function getByWhere($where, $offset, $limit)
    {
        return $this->where($where)->limit($offset, $limit)->order('id desc')->select();
    }

    public function getAllCount($where)
    {
        return $this->where($where)->count();
    }

}
